<!DOCTYPE html>
<html lang="en">
<head>
    <title>poetry 博客</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/ico" href="/images/logo.png"/>
    <!-- Bootstrap -->
    <link href="/css/minoral.css" rel="stylesheet">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.css" rel="stylesheet">
    <!--<link href="/css/animate.min.css" rel="stylesheet">-->
    <link href="/css/bootstrap-checkbox.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9] -->
    <!--    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>-->
    <![endif]-->
</head>
<body class="brownish-scheme">

<!-- Preloader -->
<div class="mask">
    <div id="loader"></div>
</div>
<!--/Preloader -->

<!-- Wrap all page content here -->
<div id="wrap">

    <!-- Make page fluid -->
    <div class="row">

        <!-- Page content -->
        <div id="content" class="col-md-12 full-page login">
            <div class="welcome"><img src="/img/poetry.png" alt class="logo">
                <h1><strong>欢迎登录</strong> 作者后台</h1>
                <h5>www.boyjfj.top</h5>
                <form name="form1" id="form-signin" class="form-signin">
                    <section>
                        <div class="input-group">
                            <input type="text" class="form-control" name="userName" placeholder="用户名">
                            <div class="input-group-addon"><i class="fa fa-user" style="line-height: 32px;"></i></div>
                        </div>
                        <div class="input-group">
                            <input type="password" class="form-control" name="password" placeholder="密码" onkeydown="if(event.keyCode==13){blogLogin();}">
                            <div class="input-group-addon"><i class="fa fa-key" style="line-height: 32px;"></i></div>
                        </div>
                    </section>
                    <section class="new-acc">
                        <button type="button" id="submit" name="sm1" class="btn btn-greensea" onkeydown="if(event.keyCode==13){blogLogin();}">登录</button>
                    </section>
                </form>
            </div>
        </div>
        <!-- Page content end -->

    </div>
    <!-- Make page fluid-->

</div>
<!-- Wrap all page content end -->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="/js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="/js/bootstrap.min.js"></script>
<script src="/js/run_prettify.js"></script>
<script src="/js/plugins/jquery.nicescroll.min.js"></script>
<script src="/js/plugins/blockui/jquery.blockUI.js"></script>
<script src="/js/minoral.min.js"></script>
<script src="/js/layer.js"></script>
<script>
    $(function () {
        $('.welcome').addClass('animated bounceIn');

        $("#submit").click(blogLogin);
    });
    function blogLogin() {
        $.ajax({
            url: '/user/login',
            type: 'post',
            dataType: 'json',
            data: {
                userName: $('input[name=userName]').val(),
                password: $('input[name=password]').val()
            },
            success: function (res) {
                if (res.status !== 200) {
                    layer.alert(res.msg, {icon: 5});
                    return false;
                }
                location.href = '/page/index';
            }

        })
    };
</script>
</body>
</html>